package com.teachoa.enumtype;

public enum ModuleEnum {
	
	SYSTEM(1, "系统管理"),
	USER(2, "用户管理"),
	TEACH(3, "教师学生管理"),
	PROJECT(4, "项目管理");
	
	private int code;
	private String desc;
	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public String getDesc() {
		return desc;
	}
	public void setDesc(String desc) {
		this.desc = desc;
	}
	private ModuleEnum(int code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	public static ModuleEnum getEnumByCode(int code) {
		ModuleEnum[] enums = ModuleEnum.values();
		for(ModuleEnum enumtype:enums) {
			if(enumtype.getCode()==code) {
				return enumtype;
			}
		}
		return null;
	}
	
}
